//
//  UIBarButtonItem-Extension.swift
//  JMWB
//
//  Created by 个人电脑 on 16/3/15.
//  Copyright © 2016年 个人电脑. All rights reserved.
//

import UIKit

extension UIBarButtonItem{

    convenience init(imageName : String, target : AnyObject? , action : Selector) {
        let btn = UIButton(type: .Custom)
        btn.setImage(UIImage(named: imageName), forState: .Normal)
        btn.setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        btn.sizeToFit()
        
        btn.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        self.init(customView : btn)
    }
}
